package com.yonyou.pmclouds.basecom.conf;

import com.yonyou.pmclouds.basecom.condition.PublicDeployCondition;
import com.yonyou.pmclouds.basecom.interceptor.TrialInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
@Conditional(PublicDeployCondition.class)
public class TrialInterceptorConfiguration extends WebMvcConfigurerAdapter {

    @Autowired
    private TrialInfoProperties trialInfoProperties;

    public void addInterceptors(InterceptorRegistry registry){

        InterceptorRegistration interceptorRegistry =
                registry.addInterceptor(new TrialInterceptor(trialInfoProperties));
        interceptorRegistry.addPathPatterns("/trialInfo/trialManage/**");

    }
}
